﻿using System;
using System.Collections.Generic;
using System.Linq;
using CardGamesLibrary.Cards;
using CardGamesLibrary.Tables;

namespace CardGamesLibrary.Turns
{
    public class TableTurn : Turn 
    {
       
        private readonly IEnumerable<TableSeat> _seats;

        public TableTurn(IEnumerable<TableSeat> seats)
        {
            _seats = seats;
        }

        public override void Play()
        {
            foreach (var seat in _seats)
            {
                if(seat != null && seat.Player !=null)
                    PlayPlayerTurn(seat);
            }
        }

        protected virtual void PlayPlayerTurn(TableSeat seat)
        {
           
            seat.Player.PlayTurn(new PlayerTurn(this));
        }
    }
}